//
//  LDTHDWebController.m
//  EPA
//
//  Created by lanou3g on 16/4/23.
//  Copyright © 2016年 浮夸. All rights reserved.
//

#import "LDTHDWebController.h"
#import "LDTNetWorkRequestManager.h"

@interface LDTHDWebController ()

@end

@implementation LDTHDWebController

- (void)viewDidLoad {
    [super viewDidLoad];
   
    UIWebView *webView = [[UIWebView alloc]initWithFrame:self.view.bounds];
    [self.view addSubview:webView];

    [LDTNetWorkRequestManager requestURL:[NSURL URLWithString:READCONTENT_URL] Method:LDT_POST Params:@{@"contentid":self.ID,@"client":@"1",@"deviceid":@"63A94D37-33F9-40FF-9EBB-481182338873",@"auth":@"Wc06FCrkoq1DCMVzGMTikDJxQ8bm3Mrm2NpT9qWjwzcWP23tBKQx1c4P0",@"version":@"3.0.2"} Result:^(NSData *data, NSURLResponse *response, NSError *error) {
       
        if (data) {
            
            NSMutableDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
            
            NSDictionary *dict = jsonDict[@"data"];
            NSDictionary *dic = dict[@"shareinfo"];
            self.ID = dic[@"url"];
            
            //加载网址
            NSURL *url = [NSURL URLWithString:self.ID];
            [webView loadRequest:[NSURLRequest requestWithURL:url]];
            
        }

        
        
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
